<template>
  <Dialog :title="dialogTitle" v-model="dialogVisible" width="25%">
    <el-form ref="formRef" :model="formData" label-width="120px" v-loading="formLoading">
      <el-form-item label="商户名:" prop="storeOwnName">
        {{ formData.storeOwnName }}
      </el-form-item>
      <el-form-item label="营业执照" prop="businessLicenseUrl">
        <el-image
          style="width: 100px; height: 100px"
          :src="formData.businessLicenseUrl"
          :preview-src-list="new Array(formData.businessLicenseUrl)"
        />
      </el-form-item>
      <el-form-item label="健康证" prop="healthCertificateUrl">
        <el-image
          style="width: 100px; height: 100px"
          :src="formData.healthCertificateUrl"
          :preview-src-list="new Array(formData.healthCertificateUrl)"
        />
      </el-form-item>
      <el-form-item label="技能证书" prop="skillsCertificateUrl">
        <el-image
          style="width: 100px; height: 100px"
          :src="formData.skillsCertificateUrl"
          :preview-src-list="new Array(formData.skillsCertificateUrl)"
        />
      </el-form-item>
    </el-form>
  </Dialog>
</template>
<script setup lang="ts">
import * as UserDetailApi from '@/api/system/user'
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
import * as ProjectApi from '@/api/meijia/project'
const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗

const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') // 弹窗的标题
const formLoading = ref(false) // 表单的加载中：1）修改时的数据加载；2）提交的按钮禁用
const formType = ref('') // 表单的类型：create - 新增；update - 修改
const formData = ref({
  id: undefined,
  phone: undefined,
  systemUserName: undefined
})
const formRef = ref() // 表单 Ref
const agentEmployee = ref()
const agentList = ref()
const homeProjectList = ref<ProjectApi.ProjectVO>()
const showReferenceSystemUserCode = ref(true)
const homeEmployeeList = ref()
const homeEmployeeReferenceList = ref()
/** 打开弹窗 */
const open = async (type: string, userCode: String) => {
  dialogVisible.value = true
  dialogTitle.value = '查询'
  // 修改时，设置数据
  formData.value = await UserDetailApi.getUserDetailByCode(userCode)
}
defineExpose({ open }) // 提供 open 方法，用于打开弹窗

/** 提交表单 */
const emit = defineEmits(['success']) // 定义 success 事件，用于操作成功后的回调
</script>
<style scoped>
.el-select {
  width: 100%;
}
</style>
